<%@ page contentType="text/html; charset=UTF-8" errorPage="/jsp/error.jsp" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/custom-html.tld" prefix="chtml" %>

<%@ page import="java.util.ArrayList"%>
<%@ page import="com.erp.framework.util.user.User"%>
<%@ page import="com.erp.framework.util.CommonUtil"%>
<%@ page import="com.erp.framework.util.mainmenu.MenuGroup"%>
<%@ page import="com.erp.framework.util.mainmenu.MenuObject"%>
<%@ page import="com.erp.framework.util.mainmenu.MenuGroupDelegate"%>
<%@ page import="com.erp.app.common.ProjectConstants"%>
<%@ page import="com.erp.framework.util.logger.Logger"%>

<jsp:useBean id="mainMenuForm" scope="session" type="com.erp.app.login.web.MainMenuForm" />

<script>
	function doSubmitNavForm(action, val) {
		document.navForm.pageEvent.value = action;
		if(val != null) {
			document.navForm.pageEventSrc.value = val;
		}
		document.navForm.submit();
	}

	function doSetMenuMode(val){
		if(val == "MENU_MODE_BEGINNER"){
			<%
			session.setAttribute("SESSION_MENU_MODE", ProjectConstants.MENU_MODE_BEGINNER);
			%>
		}
		if(val == "MENU_MODE_NORMAL"){
			<%
			session.setAttribute("SESSION_MENU_MODE", ProjectConstants.MENU_MODE_NORMAL);
			%>
		}
		if(val == "MENU_MODE_ADVANCED"){
			<%
			session.setAttribute("SESSION_MENU_MODE", ProjectConstants.MENU_MODE_ADVANCED);
			%>
		}
		if(val == "MENU_MODE_EXPERT"){
			<%
			session.setAttribute("SESSION_MENU_MODE", ProjectConstants.MENU_MODE_EXPERT);
			%>
		}
		document.navForm.submit();
	}
</script>

<%
User editingUser = (User) session.getAttribute(ProjectConstants.SESSION_USER);
String menuMode = mainMenuForm.getMenuMode();
%>

<form name="navForm" method="POST" action="/EdalWeb/mainMenu.do">
<input type="hidden" name="pageEvent">
<input type="hidden" name="pageEventSrc">

<table border=0 cellpadding= cellspacing=0>
	<tr>
		<% if(!ProjectConstants.MENU_MODE_BEGINNER.equals(menuMode)){ %>
		<td nowrap>
			<INPUT TYPE="button" class=button1 onclick="javascript:doSetMenuMode( '<%=ProjectConstants.MENU_MODE_BEGINNER%>');" value="Beginner's Menu">
		</td>
		<% } %>

		<% if(!ProjectConstants.MENU_MODE_NORMAL.equals(menuMode)){ %>
		<td nowrap>			
			<INPUT TYPE="button" class=button1 onclick="javascript:doSetMenuMode( '<%=ProjectConstants.MENU_MODE_NORMAL%>');" value="Normal Menu">			
		</td>
		<% } %>

		<% if(!ProjectConstants.MENU_MODE_ADVANCED.equals(menuMode)){ %>
		<td nowrap>
			<INPUT TYPE="button" class=button1 onclick="javascript:doSetMenuMode('<%=ProjectConstants.MENU_MODE_ADVANCED%>');" value="Advanced Menu">			
		</td>
		<% } %>

		<% if(!ProjectConstants.MENU_MODE_EXPERT.equals(menuMode)){ %>
		<td nowrap>
			<INPUT TYPE="button" class=button1 onclick="javascript:doSetMenuMode('<%=ProjectConstants.MENU_MODE_EXPERT%>');" value="Expert Menu">		
		</td>
		<% } %>

		<td>
			Current Menu Mode is: <%=menuMode%>
		</td>
	</tr>
</table>